<?php

namespace common\models\base;

use Yii;


/**
 * This is the model class for table "{{%archive}}".
 *
 * @property integer $id
 * @property integer $organization_id
 * @property string $arc_type
 * @property string $recipients
 * @property integer $author_id
 * @property string $title
 * @property string $content
 * @property integer $published_at
 * @property integer $expired_at
 * @property integer $created_by
 * @property integer $created_at
 * @property integer $updated_by
 * @property integer $updated_at
 * @property integer $deleted_by
 * @property integer $deleted_at
 * @property integer $is_deleted
 * @property integer $status
 */
class Archive extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%archive}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['organization_id'], 'required'],
            [['organization_id', 'author_id', 'published_at', 'expired_at', 'created_by', 'created_at', 'updated_by', 'updated_at', 'deleted_by', 'deleted_at', 'is_deleted', 'status'], 'integer'],
            [['content'], 'string'],
            [['arc_type'], 'string', 'max' => 20],
            [['recipients'], 'string', 'max' => 500],
            [['title'], 'string', 'max' => 100],
            [['created_by'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['created_by' => 'id']],
            [['organization_id'], 'exist', 'skipOnError' => true, 'targetClass' => Organization::className(), 'targetAttribute' => ['organization_id' => 'id']],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => '文档序号',
            'organization_id' => '机构',
            'arc_type' => '类型',
            'recipients' => '对象，组',
            'author_id' => '作者',
            'title' => '标题',
            'content' => '正文',
            'published_at' => '定时发布时间',
            'expired_at' => '过期时间',
            'created_by' => '创建人',
            'created_at' => '创建时间',
            'updated_by' => '最后更新时间',
            'updated_at' => '最后更新时间',
            'deleted_by' => '删除人',
            'deleted_at' => '删除时间',
            'is_deleted' => '是否已删除',
            'status' => '状态',
        ];
    }
}
